<template>
  <div class="page-header-index-wide">
    <div>
      <div class="account-settings-info-left" v-if="!disPLAY_none">
        <a-menu mode="horizontal" :selectedKeys="selectedKeys" type="inner" @openChange="onOpenChange"
          style="padding:8px 16px 0;">
          <a-menu-item key="/appCenter/addFaceExpand/faceList" class="border-cantainer">
            <router-link :to="{ name: 'faceList' }">
              <div class="border_catainer_bottom">人脸考勤</div>
            </router-link>
          </a-menu-item>
          <a-menu-item key="/appCenter/cardClockInExpand/byCard" class="border-cantainer">
            <router-link :to="{ name: 'byCard' }">
              <div class="border_catainer_bottom">考勤打卡</div>
            </router-link>
          </a-menu-item>
          <a-menu-item key="/appCenter/cardClockInExpand/byCardList" class="border-cantainer">
            <router-link :to="{ name: 'byCardList' }">
              <div class="border_catainer_bottom">考勤记录</div>
            </router-link>
          </a-menu-item>
        </a-menu>
      </div>
      <div class="quittanceChildren">
        <route-view></route-view>
      </div>
    </div>
  </div>
</template>

<script>
import { PageView, RouteView } from '@/layouts'
import { mixinDevice } from '@/utils/mixin.js'

export default {
  components: {
    RouteView,
    PageView,
  },
  mixins: [mixinDevice],
  data() {
    return {
      mode: 'inline',
      openKeys: [],
      selectedKeys: [],
      disPLAY_none: false,
      preview: {},
      option: {
        img: '/avatar2.jpg',
        info: true,
        size: 1,
        outputType: 'jpeg',
        canScale: false,
        autoCrop: true,
        // 只有自动截图开启 宽度高度才生效
        autoCropWidth: 180,
        autoCropHeight: 180,
        fixedBox: true,
        // 开启宽度和高度比例
        fixed: true,
        fixedNumber: [1, 1],
      },

      pageTitle: '',
    }
  },
  mounted() {
    this.updateMenu()
  },
  methods: {
    onOpenChange(openKeys) {
      this.openKeys = openKeys
    },
    updateMenu() {
      const routes = this.$route.matched.concat()
      this.selectedKeys = [routes.pop().path]
      if (
        this.selectedKeys[0] == '/appCenter/interactExpand/createLives' ||
        this.selectedKeys[0] == '/appCenter/interactExpand/editLives'
      ) {
        this.disPLAY_none = true
      } else {
        this.disPLAY_none = false
      }
    },
  },
  watch: {
    $route(val) {
      this.updateMenu()
    },
  },
}
</script>

<style lang="less">
.border-cantainer {
  padding: 0 10px;
  margin-right: 40px;
}
</style>
